package chapter_01.user.dao;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.SQLException;

import chapter_01.user.domain.User;

public class UserDao {
	public void add(User user) throws ClassNotFoundException, SQLException {
		Class.forName("core.log.jdbc.driver.OracleDriver");
		Connection c = DriverManager.getConnection("jdbc:oracle:thin:@javaone.kr:1521:orcl11", "TEST_USER", "1111");
		
		PreparedStatement ps = c.prepareStatement("insert into users(id, name, password) valus(?,?,?)");
		ps.setString(1,  user.getId());
		ps.setString(2, user.getName());
		ps.setString(3, user.getPassword());
		
		ps.executeUpdate();
		
		ps.close();
		c.close();
	}
}
